<template>
  <div>
    <el-table :data="need">
      <el-table-column prop="code" label="编号"> </el-table-column>
      <el-table-column prop="title" label="标题"> </el-table-column>
      <el-table-column prop="described" label="描述"> </el-table-column>
      <el-table-column prop="money" label="金币"> </el-table-column>
      <el-table-column prop="userid" label="雇主"> </el-table-column>
      <el-table-column
        prop="closeid"
        label="支付方式"
        :formatter="zhifu"
      ></el-table-column>
      <el-table-column prop="" label="操作">
        <template slot-scope="scope">
          <el-button type="text" size="small" @click="tj(scope.row.code)"
            >提交</el-button
          >
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      need: "",
      userid: localStorage.getItem("userid"),
    };
  },
  mounted() {
    this.userneed();
  },
  methods: {
    zhifu(row, column) {
      if (row.closeid == 1) {
        return "按项目支付";
      } else {
        return "按时间支付";
      }
    },
    userneed() {
      this.axios.get("/userneed?userid=" + this.userid).then((res) => {
        this.need = res.data.data;
      });
    },
    tj(code) {
      this.axios.get("/tjneed?code=" + code).then((res) => {
        alert(res.data.msg);
      });
    },
  },
};
</script>

<style>
</style>